package com.winderinfo.yikaotianxia.ui.setup;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.winderinfo.yikaotianxia.R;

import java.util.List;

public class FeedbackListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private Context context;
    private  List<FeedbackListBean.RowsBean> list;

    public FeedbackListAdapter(Context context,  List<FeedbackListBean.RowsBean> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_feedbacklist, viewGroup, false);
        SelectedViewHolder selectedViewHolder = new SelectedViewHolder(view);
        return selectedViewHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, final int i) {
        SelectedViewHolder selectedViewHolder = (SelectedViewHolder) viewHolder;
        selectedViewHolder.feedb_time.setText(list.get(i).getCreatetime());
        selectedViewHolder.feedb_title.setText(list.get(i).getContent());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public class SelectedViewHolder extends RecyclerView.ViewHolder {

        private final TextView feedb_time, feedb_title;

        public SelectedViewHolder(@NonNull View itemView) {
            super(itemView);
            feedb_time = itemView.findViewById(R.id.feedb_time);
            feedb_title = itemView.findViewById(R.id.feedb_title);
        }
    }

  /*  //接口回调
    public interface OnGoodsId {
        void getId(int id, String details);
    }

    public OnGoodsId onGoodsId;

    public void setOnGoodsId(OnGoodsId onGoodsId) {
        this.onGoodsId = onGoodsId;
    }*/

}
